<template>
  <!-- <div class="drawer-container">
    <div>
      <h3 class="drawer-title">Page style setting</h3>

      <div class="drawer-item">
        <span>Theme Color</span>
      </div>

      <div class="drawer-item">
        <span>Open Tags-View</span>
        <el-switch v-model="tagsView" class="drawer-switch" />
      </div>

      <div class="drawer-item">
        <span>Fixed Header</span>
        <el-switch v-model="fixedHeader" class="drawer-switch" />
      </div>

      <div class="drawer-item">
        <span>Sidebar Logo</span>
        <el-switch v-model="sidebarLogo" class="drawer-switch" />
      </div>
    </div>
  </div> -->
  <div>
    <el-tabs v-model="active" tab-position="top" style="height: 200px;margin-left:10px;margin-right:10px">
      <el-tab-pane name="one" label="查询条件">
        <search-panel @checkList="getCheckList" @search="getSearchInfo" :zoomId="0"></search-panel>
      </el-tab-pane>
      <el-tab-pane name="two" label="查询内容">
        <asset-list :searchData="searchData" :condition="searchCondition" :checkList="checkList" :zoomId="zoomId"></asset-list>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import assetList from "./assetList";
import SearchPanel from "./SearchPanel";
import { getAccessPagingConditions } from "@/api/map";
export default {
  components: { assetList, SearchPanel },
  props: {
    searchData: Object,
    zoomId: { type: Number, default: 0 },
    activeName: {
      type: String,
      default: "one"
    }
  },
  data() {
    return {
      active: this.activeName,
      checkList: {},
      searchCondition: {}
    };
  },
  computed: {
    fixedHeader: {
      get() {
        return this.$store.state.settings.fixedHeader;
      },
      set(val) {
        this.$store.dispatch("settings/changeSetting", {
          key: "fixedHeader",
          value: val
        });
      }
    },
    tagsView: {
      get() {
        return this.$store.state.settings.tagsView;
      },
      set(val) {
        this.$store.dispatch("settings/changeSetting", {
          key: "tagsView",
          value: val
        });
      }
    },
    sidebarLogo: {
      get() {
        return this.$store.state.settings.sidebarLogo;
      },
      set(val) {
        this.$store.dispatch("settings/changeSetting", {
          key: "sidebarLogo",
          value: val
        });
      }
    }
  },
  methods: {
    themeChange(val) {
      this.$store.dispatch("settings/changeSetting", {
        key: "theme",
        value: val
      });
    },
    getCheckList(list) {
      this.checkList = list;
      this.$emit("getCheckList", list);
      this.active = "two";
    },
    getSearchInfo(info) {
      this.searchCondition = info;
      this.active = "two";
      info.page = 1;
      // getAccessPagingConditions(info).then(res => {
      //   this.$emit("getCheckList", res);
      // });
    }
  }
};
</script>

<style lang="scss" scoped>
.drawer-container {
  padding: 24px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;

  .drawer-title {
    margin-bottom: 12px;
    color: rgba(0, 0, 0, 0.85);
    font-size: 14px;
    line-height: 22px;
  }

  .drawer-item {
    color: rgba(0, 0, 0, 0.65);
    font-size: 14px;
    padding: 12px 0;
  }

  .drawer-switch {
    float: right;
  }
}
</style>
